package Thread;

import java.util.concurrent.CountDownLatch;

public class Demo06 {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch latch = new CountDownLatch(10);
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("运行中");
                latch.countDown();
            }
        };
        for (int i = 0; i < 10; i++) {
            new Thread(runnable).start();
        }
        latch.await();
        System.out.println("运行结束");
    }
}
